import {defineStore} from "pinia";
import {AppStoreActions, AppStoreState} from "./types";



export const appStore = defineStore<string, AppStoreState, any,AppStoreActions>("appStore",{
    state: () : AppStoreState=> {
        return {
            loading: false
        }
    },
    getters: {
        loadingState():boolean{
            return this.loading;
        }
    },
    actions: {
        /**
         * 修改 loading 状态
         * @param loadingState
         */
        changeLoadingState(loadingState:boolean):void{
            if (this.loading == loadingState){
                return;
            }
            this.loading = loadingState;
            console.log("修改 loading 状态为：" + loadingState)
        }
    }
})
